<?php
/**
 * @package     Joomla.Site
 * @subpackage  Templates.protostar
 *
 * @copyright   Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

$app             = JFactory::getApplication();
$doc             = JFactory::getDocument();
$user            = JFactory::getUser();
$this->language  = $doc->language;
$this->direction = $doc->direction;

// Getting params from template
$params = $app->getTemplate(true)->params;

// Detecting Active Variables
$option   = $app->input->getCmd('option', '');
$view     = $app->input->getCmd('view', '');
$layout   = $app->input->getCmd('layout', '');
$task     = $app->input->getCmd('task', '');
$itemid   = $app->input->getCmd('Itemid', '');
$sitename = $app->get('sitename');

$doc->setGenerator('');


if($task == "edit" || $layout == "form" )
{
	$fullWidth = 1;
}
else
{
	$fullWidth = 0;
}

// Add JavaScript Frameworks
JHtml::_('bootstrap.framework');
$doc->addScript($this->baseurl . '/templates/' . $this->template . '/js/template.js');

//$doc->addScript($this->baseurl . '/templates/' . $this->template . '/js/jquery.nested.js');
//$doc->addScript($this->baseurl . '/templates/' . $this->template . '/js/makeboxes.js');

// Add Stylesheets
$doc->addStyleSheet($this->baseurl . '/templates/' . $this->template . '/css/template.css');

// Load optional RTL Bootstrap CSS
JHtml::_('bootstrap.loadCss', false, $this->direction);

// Adjusting content width
if ($this->countModules('position-7') && $this->countModules('position-8'))
{
	$span = "span6";
}
elseif ($this->countModules('position-7') && !$this->countModules('position-8'))
{
	$span = "span9";
}
elseif (!$this->countModules('position-7') && $this->countModules('position-8'))
{
	$span = "span9";
}
else
{
	$span = "span12";
}

// Logo file or site title param
if ($this->params->get('logoFile'))
{
	$logo = '<img class="image-logo" src="' . JUri::root() . $this->params->get('logoFile') . '" alt="' . $sitename . '" />';
}
elseif ($this->params->get('sitetitle'))
{
	$logo = '<span class="site-title" title="' . $sitename . '">' . htmlspecialchars($this->params->get('sitetitle')) . '</span>';
}
else
{
	$logo = '<span class="site-title" title="' . $sitename . '">' . $sitename . '</span>';
}
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xml:lang="<?php echo $this->language; ?>"
	lang="<?php echo $this->language; ?>"
	dir="<?php echo $this->direction; ?>">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<jdoc:include type="head" />
	<?php // Use of Google Font ?>
	<?php if ($this->params->get('googleFont')) : ?>
		<link
	href='//fonts.googleapis.com/css?family=<?php echo $this->params->get('googleFontName'); ?>'
	rel='stylesheet' type='text/css' />
<style type="text/css">
h1, h2, h3, h4, h5, h6, .site-title { //
	font-family: '<?php echo str_replace(' + ', ' ', $this->params->get(' googleFontName
		')); ?>', sans-serif;
}
</style>
	<?php endif; ?>
	<?php // Template color ?>
	<?php if ($this->params->get('templateColor')) : ?>
	<style type="text/css">
body.site { //
	border-top: 3px solid<?php echo$this->params->get('templateColor'); ?>;
	//
	background-color: <?php echo$this->params->get('templateBackgroundColor');
	?>
}

a { //
	color: <?php echo$this->params->get('templateColor');
	?>;
}

.navbar-inner, .nav-list>.active>a, .nav-list>.active>a:hover,
	.dropdown-menu li>a:hover, .dropdown-menu .active>a, .dropdown-menu .active>a:hover,
	.nav-pills>.active>a, .nav-pills>.active>a:hover, .btn-primary { //
	//background: <?php echo$this->params->get('templateColor'); ?>;
	//background-color: #ededed;
}

.navbar-inner {
	-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, .25), inset 0 -1px 0
		rgba(0, 0, 0, .1), inset 0 30px 10px rgba(0, 0, 0, .2);
	-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, .25), inset 0 -1px 0
		rgba(0, 0, 0, .1), inset 0 30px 10px rgba(0, 0, 0, .2);
	box-shadow: 0 1px 3px rgba(0, 0, 0, .25), inset 0 -1px 0
		rgba(0, 0, 0, .1), inset 0 30px 10px rgba(0, 0, 0, .2);
}
</style>
	<?php endif; ?>
	<!--[if lt IE 9]>
		<script src="<?php echo JUri::root(true); ?>/media/jui/js/html5.js"></script>
	<![endif]-->
<script type="text/javascript">
  (function($){   
    $(document).ready(function(){
      // dropdown
      $('.parent').addClass('dropdown');
      $('.parent > a').addClass('dropdown-toggle');
      $('.parent > a').attr('data-toggle', 'dropdown');
      $('.parent > a').append('<b class="caret"></b>');
      $('.parent > ul').addClass('dropdown-menu');
      $('#header').scrollspy();
    });
      
  })(jQuery);

</script>
</head>

<body data-spy="scroll" data-target="#header"
	class="site <?php echo $option
	. ' view-' . $view
	. ($layout ? ' layout-' . $layout : ' no-layout')
	. ($task ? ' task-' . $task : ' no-task')
	. ($itemid ? ' itemid-' . $itemid : '')
	. ($params->get('fluidContainer') ? ' fluid' : '');
?>">

	<!-- Body -->
	<div class="body">

		<div id="header">
			<div class="container">
				<div class="row-fluid">

					<!-- Header -->
					<div id="logo" class="span2">
						<div class="header-inner clearfix">
							<a class="brand pull-left" href="<?php echo $this->baseurl; ?>/">
							<?php echo $logo; ?>
							<?php if ($this->params->get('sitedescription')) : ?>
								<?php echo '<div class="site-description">' . htmlspecialchars($this->params->get('sitedescription')) . '</div>'; ?>
							<?php endif; ?>
						</a>
							<div class="header-search pull-right">
								<jdoc:include type="modules" name="position-0" style="none" />
							</div>
						</div>
					</div>
					<!-- navigation -->				
				<?php if ($this->countModules('position-1')) : ?>
				<div class="span10" id="main-menu">
						<nav class="navbar" role="navigation">
							<a class="btn btn-navbar" data-toggle="collapse"
								data-target=".nav-collapse"> <span class="icon-bar"></span> <span
								class="icon-bar"></span> <span class="icon-bar"></span>
							</a>
							<a class="brand" href="#">Menu</a>
							<div class="nav-collapse collapse" id="myNavbar">
								<jdoc:include type="modules" name="position-1" style="none" />
							</div>
						</nav>
					</div>			
				<?php endif; ?>
				
			</div>
			</div>
		</div>

		<div id="main-slider">
			<div class="container">
				<jdoc:include type="modules" name="main-slider" style="none" />
			</div>
		</div>
		
		<?php if ($this->countModules('blog')) : ?>
		<div id="main-intro">
			<div class="container">
				<jdoc:include type="modules" name="banner" style="xhtml" />
			</div>
		</div>
		<?php endif; ?>
		
		<?php if ($this->countModules('blog')) : ?>
		<div id="main-blog">
			<div class="container">
				<div id="mod-blog" class="row-fluid">
					<h2 class="title">
						Các khóa học <span style="">&raquo;</span>
					</h2>
					<jdoc:include type="modules" name="blog" style="xhtml" />
				</div>
			</div>
		</div>
		<?php endif; ?>
		
		<?php if ($this->countModules('opinion')) : ?>
		<div id="main-customer">
			<div class="container">
				<div class="row-fluid">
					<h2 class="title">
						Ý kiến khách hàng về <span class="green">Brainpower</span> <span>&raquo;</span>
					</h2>
					<jdoc:include type="modules" name="opinion" style="xhtml" />
				</div>
				<?php if ($this->countModules('join-class') && $this->countModules('join-video')) : ?>
				<div id="join-class" class="row-fluid">
					<div class="span6">
						<jdoc:include type="modules" name="join-class" style="xhtml" />
					</div>
					<div class="span6">
						<jdoc:include type="modules" name="join-video" style="xhtml" />
					</div>
				</div>	
				<?php endif; ?>	
			</div>
		</div>
		<?php endif; ?>
		
		<?php if ($this->countModules('block-action')) : ?>
		<div id="blog-action">
			<div class="container">
				<div class="row-fluid">
					<h2 class="title">
						Hoạt động <span>&raquo;</span>
					</h2>
					<jdoc:include type="modules" name="block-action" style="xhtml" />
				</div>
			</div>	
		</div>
		<?php endif; ?>
		
		<div id="main-page" class="container<?php echo ($params->get('fluidContainer') ? '-fluid' : ''); ?>">
		<div class="row-fluid">
				<?php if ($this->countModules('position-8')) : ?>
					<!-- Begin Sidebar -->
			<div id="sidebar" class="span3">
				<div class="sidebar-nav">
					<jdoc:include type="modules" name="position-8" style="xhtml" />
				</div>
			</div>
			<!-- End Sidebar -->
				<?php endif; ?>
				
				<main id="content" role="main" class="<?php echo $span; ?>"> 
				<!-- Begin Content -->
				<jdoc:include type="modules" name="position-3" style="xhtml" /> 
				
				<jdoc:include type="message" /> 
				<jdoc:include type="component" /> 
				
				<jdoc:include type="modules" name="position-2" style="none" /> 
				<!-- End Content -->
			</main>
				<?php if ($this->countModules('position-7')) : ?>
					<div id="aside" class="span3 right">
				<!-- Begin Right Sidebar -->
				<jdoc:include type="modules" name="position-7" style="well" />
				<!-- End Right Sidebar -->
			</div>
				<?php endif; ?>
			</div>
	</div>
			<?php if ($this->countModules('logo-partner')) : ?>
	<section id="partner">
		<div class="container">
			<div class="row-fluid">
				<jdoc:include type="modules" name="logo-partner" style="none" />
			</div>
		</div>
	</section>
	<?php endif; ?>
	</div>

	<!-- Footer -->
	<footer class="footer" role="contentinfo">

		<div class="top-footer">
			<div class="container">
				<jdoc:include type="modules" name="footer" style="none" />
			</div>
		</div>

		<div class="middle-footer">
			<div class="container">
				<jdoc:include type="modules" name="footer-address" style="none" />

				<div id="sub-info" class="row-fluid">

				
				<jdoc:include type="modules" name="footer-subinfo" style="footer" />

					
				</div>




			</div>
		</div>


		<div class="bottom-footer">
			<div class="container">
				<div class="row-fluid">
					<p class="span6 pull-left">
				Copyright &copy; 2014 - <?php echo date('Y'); ?> <?php echo $sitename; ?>.
				</p>

					<p class="span6 pull-right">Thiết kế và phát triển bởi <a href="http://thietkeweblkv.com" target="_blank">LKV Solutions</a></p>
				</div>
			</div>
		</div>
	</footer>
	
	<jdoc:include type="modules" name="debug" style="none" />
</body>
</html>
